package com.cardone.platform.configuration.service;

import java.util.List;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.cache.Caches;
import com.cardone.common.dto.PaginationDto;
import com.cardone.platform.configuration.dto.DictionaryItemDto;

/**
 * 字典项服务
 *
 * @author yaohaitao
 */
public interface DictionaryItemService {
	/**
	 * spring bean id
	 */
	String BEAN_ID = "com.cardone.platform.configuration.service.DictionaryItemService";

	/**
	 * 保存:字典项
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param saveDictionaryItem
	 *          字典项对象
	 *
	 * @return 字典项对象
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = DictionaryItemService.BEAN_ID, allEntries = true)
	<P> P saveByIdOrCode(final Class<P> mappedClass, final DictionaryItemDto saveDictionaryItem);

	/**
	 * 插入
	 *
	 * @param insertDictionaryItem
	 *          字典项对象
	 *
	 * @return 影响行数
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = DictionaryItemService.BEAN_ID, allEntries = true)
	int insertByCode(final DictionaryItemDto insertDictionaryItem);

	/**
	 * 删除
	 *
	 * @param deleteDictionaryItem
	 *          字典项对象
	 *
	 * @return 影响行数
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = DictionaryItemService.BEAN_ID, allEntries = true)
	int deleteByIds(final DictionaryItemDto deleteDictionaryItem);

	/**
	 * 更新
	 *
	 * @param updateDictionaryItem
	 *          字典项对象
	 *
	 * @return 影响行数
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = DictionaryItemService.BEAN_ID, allEntries = true)
	int updateByCode(final DictionaryItemDto updateDictionaryItem);

	/**
	 * 查询
	 *
	 * @param readDictionaryItem
	 *          字典项对象
	 * @return 返回数据
	 */
	@Deprecated
	@Cacheable(value = DictionaryItemService.BEAN_ID, key = Caches.KEY_1)
	Integer readByCodeNqIdForCount(final DictionaryItemDto readDictionaryItem);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findDictionaryItem
	 *          字典项对象
	 * @return 返回对象
	 */
	@Deprecated
	@Cacheable(value = DictionaryItemService.BEAN_ID, key = Caches.KEY_2)
	<P> P findById(final Class<P> mappedClass, final DictionaryItemDto findDictionaryItem);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findDictionaryItem
	 *          字典项对象
	 *
	 * @return 返回对象
	 */
	@Deprecated
	@Cacheable(value = DictionaryItemService.BEAN_ID, key = Caches.KEY_2)
	<P> P findByCodeOrId(final Class<P> mappedClass, final DictionaryItemDto findDictionaryItem);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findListDictionaryItem
	 *          字典项对象
	 *
	 * @return 字典项对象集合
	 */
	@Deprecated
	@Cacheable(value = DictionaryItemService.BEAN_ID, key = Caches.KEY_2)
	<P> List<P> findListByLikeCode(final Class<P> mappedClass, final DictionaryItemDto findListDictionaryItem);

	/**
	 * 分页
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param paginationDictionaryItem
	 *          字典项对象
	 *
	 * @return 字典项分页对象
	 */
	@Deprecated
	@Cacheable(value = DictionaryItemService.BEAN_ID, key = Caches.KEY_2)
	<P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final DictionaryItemDto paginationDictionaryItem);
}